# coding=utf-8

import scrapy

"""
    登录策略一: 直接提交post表单数据登录
"""

class Renren1Spider(scrapy.Spider):

    name = "renren1"
    allowed_domains = ["renren.com"]


    def start_requests(self):
        url = "http://www.renren.com/PLogin.do"
        # 发送请求
        yield scrapy.FormRequest(
            url= url,
            formdata={
                "email" : "17612153143",
                "password" : "fyy...354109"
            },

            callback=self.parse_page
        )

    def parse_page(self,response):
        with open("mao2.html", "w") as file:
            file.write(response.body)